<?php

namespace app\controller\admin\module\common;

use think\Response;
use think\response\Json;

/**
 * @auth-name 数据形式
 * @auth-alias common
 */
class Index
{
    /**
     * @auth-name 图片上传
     * @return Json
     */
    public function uploadImage(): Json
    {
        $res = components\Upload::getInstance()->file('image');
        return responseMsg($res['msg'], $res['code'], $res['data']);
    }

    /**
     * @auth-name 图片删除
     * @return Json
     */
    public function delImage(): Json
    {
        $res = components\Upload::getInstance()->delete(values('url'));
        return responseMsg($res['msg'], $res['code'], $res['data']);
    }

    /**
     * 验证码
     * @return Response
     */
    public function verify(): Response
    {
        return \think\captcha\facade\Captcha::create();
    }

}